// Main Menu主菜单和Sub Menu子菜单 删除 和 顺序更新
import {request} from '@/framework/network/request'
import {buildGetApiByType, buildPostApiByType} from '@/framework/apis'
import {apiType} from '@/apis/index'

const buildGetApi = (url: string) => buildGetApiByType(url, apiType.position)
const buildPostApi = (url: string) => buildPostApiByType(url, apiType.position)

export const createAndBindPosition = (positionId: number | string, userName: string, name: string, phoneNumber: string) =>
    request(buildPostApi('/create/bind'), {}, {positionId, userName, name, phoneNumber}, true) as Promise<any>
export const bindPosition = (positionId: number | string, customerNumber: string) =>
  request(buildPostApi('/bind'), {}, {positionId, customerNumber}, true) as Promise<any>
export const unBindPosition = (id: number | string) =>
    request(buildPostApi('/unBind'), {}, {id}, true) as Promise<any>
